<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:70:"F:\phpStudy\WWW\tpadmin\public/../application/index\view\menu\add.html";i:1517030462;}*/ ?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>后台首页 - 添加菜单</title>
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<!-- basic styles -->
		<link href="__STATIC__/assets/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="__STATIC__/assets/css/font-awesome.min.css" />
		<link rel="stylesheet" href="__STATIC__/font-awesome-4.7.0/css/font-awesome.min.css" />

		<!--[if IE 7]>
		  <link rel="stylesheet" href="__STATIC__/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

		<!-- page specific plugin styles -->

		<!-- fonts -->

		<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />

		<!-- ace styles -->

		<link rel="stylesheet" href="__STATIC__/assets/css/ace.min.css" />
		<link rel="stylesheet" href="__STATIC__/assets/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="__STATIC__/assets/css/ace-skins.min.css" />
		<link rel="stylesheet" href="__STATIC__/css/public.css" />

		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="__STATIC__/assets/css/ace-ie.min.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->

		<script src="__STATIC__/assets/js/ace-extra.min.js"></script>

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

		<!--[if lt IE 9]>
		<script src="__STATIC__/assets/js/html5shiv.js"></script>
		<script src="__STATIC__/assets/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body style="background:#fff;">

		<form class="form-horizontal col-xs-12" role="form">
			<div class="form-group" style="margin-top:20px">
				<label for="pid" class="col-xs-2 control-label" style="text-align:right"><span class="red">*&nbsp;</span>所属菜单:</label>
				<div class="col-xs-9">
					<select id="pid" class="form-control" name="pid">
						<option value="0">顶级菜单</option>
						<?php if(is_array($menuArr) || $menuArr instanceof \think\Collection || $menuArr instanceof \think\Paginator): $i = 0; $__LIST__ = $menuArr;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?>
							<option value="<?php echo $menu['id']; ?>"><?php echo str_repeat('&nbsp;',($menu['level']-1)*3); if($menu['level'] > 1): ?>|---<?php endif; ?><?php echo $menu['name']; ?></option>
						<?php endforeach; endif; else: echo "" ;endif; ?>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="name" class="col-xs-2 control-label" style="text-align:right"><span class="red">*&nbsp;</span>菜单名称:</label>
				<div class="col-xs-9">
					<input type="text" id="name" class="form-control" name="name" value="" />
				</div>
			</div>
			<div class="form-group">
				<label for="icon" class="col-xs-2 control-label" style="text-align:right"><span class="red">*&nbsp;</span>菜单图标:</label>
				<div class="col-xs-9">
					<input type="text" id="icon" class="form-control" name="icon" value="" />
				</div>
			</div>
			<div class="form-group">
				<label for="model" class="col-xs-2 control-label" style="text-align:right"><span class="red">*&nbsp;</span>模块名:</label>
				<div class="col-xs-9">
					<input type="text" id="model" class="form-control" name="model" value="" />
				</div>
			</div>
			<div class="form-group">
				<label for="controller" class="col-xs-2 control-label" style="text-align:right"><span class="red">*&nbsp;</span>控制器名:</label>
				<div class="col-xs-9">
					<input type="text" id="controller" class="form-control" name="controller" value="" />
				</div>
			</div>
			<div class="form-group">
				<label for="method" class="col-xs-2 control-label" style="text-align:right"><span class="red">*&nbsp;</span>方法名:</label>
				<div class="col-xs-9">
					<input type="text" id="method" class="form-control" name="method" value="" />
				</div>
			</div>
			<div class="form-group">
				<label for="is_show" class="col-xs-2 control-label" style="text-align:right"><span class="red">*&nbsp;</span>是否显示:</label>
				<div class="col-xs-9">
					<input id="is_show" name="is_show" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5">
					<span class="lbl"></span>
				</div>
			</div>
			<div class="form-group">
				<label for="sort" class="col-xs-2 control-label" style="text-align:right"><span class="red">*&nbsp;</span>排序:</label>
				<div class="col-xs-9">
					<input type="text" id="sort" class="form-control" name="sort" value="" />
				</div>
			</div>
			<span class="col-xs-2"></span><button type="button" id="send" class="btn btn-primary noborder col-xs-1">提交</button>
		</form>

		<!-- basic scripts -->

		<!--[if !IE]> -->

		<script src="__STATIC__/assets/js/jquery-2.0.3.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="__STATIC__/assets/js/jquery-2.0.3.min.js"></script>
<![endif]-->

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='__STATIC__/assets/js/jquery-2.0.3.min.js'>"+"<"+"script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='__STATIC__/assets/js/jquery-1.10.2.min.js'>"+"<"+"script>");
</script>
<![endif]-->

		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='__STATIC__/assets/js/jquery.mobile.custom.min.js'>"+"<"+"script>");
		</script>
		<script src="__STATIC__/assets/js/bootstrap.min.js"></script>

		<!-- page specific plugin scripts -->

		<!--[if lte IE 8]>
		  <script src="__STATIC__/assets/js/excanvas.min.js"></script>
		<![endif]-->

		<script src="__STATIC__/assets/js/jquery-ui-1.10.3.custom.min.js"></script>

		<!-- ace scripts -->

		<script src="__STATIC__/assets/js/ace-elements.min.js"></script>
		<script src="__STATIC__/assets/js/ace.min.js"></script>
		<script src="__STATIC__/layui-v2.2.45/layui.all.js"></script>

		<!-- inline scripts related to this page -->

		<script type="text/javascript">
			$(function(){
				$('#send').click(function(){
					if($('#name').val() == ''){
						layer.msg('菜单名称不能为空',function(){
							$('#name').focus();
						})
						return;
					}
					if($('#model').val() == ''){
						layer.msg('模块名不能为空',function(){
							$('#model').focus();
						})
						return;
					}
					if($('#controller').val() == ''){
						layer.msg('控制器名不能为空',function(){
							$('#controller').focus();
						})
						return;
					}
					if($('#method').val() == ''){
						layer.msg('方法名不能为空',function(){
							$('#method').focus();
						})
						return;
					}
					if($('#sort').val() == ''){
						layer.msg('排序不能为空',function(){
							$('#sort').focus();
						})
						return;
					}
					$.ajax({
						type:"post",
						url:"<?php echo url('menu/add'); ?>",
						data:$("form").serialize(),
						success:function(msg){
							if(msg=='succ'){
								$('#send').addClass('disabled');
								setTimeout(function(){
									//先得到当前iframe层的索引
									var index = parent.layer.getFrameIndex(window.name);
									parent.layer.close(index); //再执行关闭
									parent.location.reload();
								},1900);
								layer.msg('菜单添加成功！',{icon:6,time:1500});
							} else if(msg=='error'){
								$('#send').addClass('disabled');
								layer.msg('菜单添加失败！',{icon:5,time:1500});
								setTimeout(function(){
									location.reload();
								},1900);
							}else{
								$('#send').addClass('disabled');
								layer.msg(msg,{icon:2,time:1500});
								setTimeout(function(){
									location.reload();
								},1900);
							}
						}
					});
				});
			});
		</script>
	<div style="display:none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>

